<%--
 *  File:    StandardManagementUnitEdit.jsp
 *  @Author: jackwang	
 *  Date:    2013/9/18
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.StandardManagementUnitEdit");
  String strModuleName = "COM";
  String strTableName = "v_opencontrolunit";
  //String privilegeCode = "A01002";
  String contextPath = request.getContextPath();

%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@include file="/inc/Print.inc"%>
<html>
<head>
<title>StandardManagementUnitEdit.jsp</title>
<PageFlow:CheckPageFlow pageName="p_opencontrolunit"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<iframe name="reloadHandler" style="display:none"></iframe>
<link rel="stylesheet" href="<%=contextPath %>/css/cn/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<%
	Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
	if(searchresults == null) searchresults = new Vector();
	String  isfirst = (String) pageContext.getAttribute("isfirst");
%>
<style type="text/css">
<!--
body{
	margin:0;padding:0;
}
.div1 {
clear: both;
float:left;
height:10px;
border: 0px solid #EEEEEE;
padding:0px;
margin:0px 0px 0px 0px;
}
.div2 {
clear: both;
height:10px;
float:left;
}
.div3 {
clear: both;
height:10px;
float:left;
}
-->
</style>
<script>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "StandardManagementUnitEdit.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
function monthresult(){
	document.cform.actionname.value = "save";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
function page_add(){
    if(!checkForm(document.cform))return;
	document.cform.actionname.value = "add";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
window.onload=function(){
          // cform.startdate.value=new Date().toFormatString("yyyy-mm-dd");
          // cform.enddate.value=new Date().toFormatString("yyyy-mm-dd");
}
function page_selectProd(num){
	if(num != null || num == ''){
		document.cform.currentnum.value=num;
 	}else{
 	 	document.cform.currentnum.value='';
 	}
	var url = "<%=contextPath%>/zylprocessgoals/zylOpenDetailWindow.jsp?opencontrolid="+document.cform.opencontrolid.value+"&opencontrolunitid="+document.cform['opencontrolunitid'+num].value+"&<%= OvalTools.randomURL()%>";
	var windowAttribute = "height=400, width=600,top=100,left=100, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=yes";
  	if(popwindow!=null) popwindow.close();
  	popwindow = window.open(url,"newwindow",windowAttribute);
}
function page_delete()
  {
    if(isNullChecked(cform.deleteids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
	cform.submit();
}
function page_save(){
    document.cform.unit.command="";
    document.cform.addupmonths.command="";
    document.cform.qty.command="";
    if(!checkForm(document.cform))return;
	document.cform.actionname.value = "save";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
</script>

</head>
<body style="overflow: auto;">
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher">
<input type="hidden" name="pagename" value="p_opencontrolunit">
<input type="hidden" name="isfirst" value="N">
<input type="hidden" name="actionname">
<input type="hidden" name="currentnum">
<input type="hidden" name="datacategory">
<input type="hidden" name="issearch">
<input type="hidden" name="arraystr">
<custom:hidden  property="opencontrolid"/>
 <input type="hidden" name="numrows" value="<%=searchresults.size() %>"/>
<table width="100%" cellspacing="0">
  <% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
</table>
	<table width="100%">
		 <tr>
    <td> 
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">
        <tr class="deepblue-left">
          <td width="1%" class="title_center">&nbsp;</td>
          <td width="4%" class="title_center"><%=label.getLabelName("L_Seq")%></td>
          <td width="2%" class="title_center"><%=label.getLabelName("L_Product")%></a><span class='red'>*</span></td>
          <td width="2%" class="title_center"><%=label.getLabelName("L_UOM1")%></a><span class='red'>*</span></td>
          <td width="7%" class="title_center"><%=label.getLabelName("L_AddUpMonths")%></a><span class='red'>*</span></td>
          <td width="7%" class="title_center"><%=label.getLabelName("L_AddUpQty")%></a><span class='red'>*</span></td>
        </tr>
          <%
             int j = 0;
             int s=1;
             String strClassType = new String();
             String strIsChecked = "";
             Integer defaultId = new Integer(-1);
             boolean bHasChecked = false;
            
          %>
          <logic:iterate id="pageconfig" collection="<%= searchresults %>" indexId="seq">
          	<%
            HashMap pageConfig = (HashMap)pageContext.getAttribute("pageconfig");
            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }

           if(!bHasChecked)
            {
              strIsChecked = "Checked";
              //System.out.print("opencriterionid="+pageConfig.get("opencriterionid"));
              defaultId = (Integer)pageConfig.get("opencontrolunitid");
              bHasChecked = true;
              
            }else{
           		strIsChecked = "";
            }
             s= ((Integer)pageConfig.get("opencontrolunitid")).intValue();
            j++;
          %>
          	<tr  class="<%=JspHelper.filterNull(strClassType)%>">
          	    <td width="1%" class="title_center"><input type="checkbox" name="deleteids" value="<%=JspHelper.filterNull( pageConfig.get("opencontrolunitid") )%>" class="checkbox"></td>
	            <custom:hidden name="pageconfig" property="opencontrolunitid"   colIndex="<%=seq %>"/>
	            <td class="title_center"><%=j %></td>
	            <td class="title_center">
				  <a onclick="page_selectProd(<%=seq %>);"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a>
	            </td>
	            <td class="title_center"><custom:selectdic name="pageconfig" property="unit"  label="L_OpenType" command="notnull" dictType="UomType" colIndex="<%=seq %>"  valueCriteria="1,6"/></td>
    	        <td class="title_center"><custom:text name="pageconfig" property="addupmonths" command="notnull,positive" colIndex="<%=seq %>" label="L_AddUpMonths"/></td>
	            <td class="title_center"><custom:text name="pageconfig" property="qty"  colIndex="<%=seq %>" command="notnull,positive" label="L_AddUpQty"/></td>
	         </tr>
          </logic:iterate>
           <tr class="none">
	           <td>&nbsp;</td>
		       <td class="title_center"><%=j+1 %></td>
		       <td class="title_center">&nbsp;</td>
		       <td class="title_center"><custom:selectdic dictType="UomType" property="unit" name="newhash" command="notnull" label="L_OpenType" defaultValue="----" defaultValueCost=" " valueCriteria="1,6"/></td>
	           <td class="title_center"><custom:text property="addupmonths"  name="newhash"  command="notnull,positive" label="L_AddUpMonths" size="20"/></td>
	           <td class="title_center"><custom:text property="qty"  name="newhash"  command="notnull,positive" label="L_AddUpQty" size="20"/></td>
		     </tr>
    <% //--------------------------------------  flipping page --%>
    <%@ include file="/inc/SummaryAction.inc" %>
    <table width="100%"> 
        <tr> 
          <td class="summary_top"></td>
        </tr>
		<tr >
			  <td class="td_center">
	           <a onclick="page_add();"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
               <%if(searchresults.size() >0 ){%>
               <a onclick="page_save();"><custom:button type="1" label="L_Save" imgsrc="save.gif" border="0" style="width:60"/></a>
               <a onclick="page_delete();"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
               <%}%>
	          </td>
	          
		</tr>
	</table>	
   </table>
</form>
</table>


</body>
</html>


